/*******************************************************************
TreeSort class

Zachary Smith

This class sorts an array using a binary tree.
*******************************************************************/
import java.util.*;

public class TreeSort
{
	public static void TreeSort(int[] myArray, int size)
	{
		BST<Item, Integer> binTree = new BST<Item, Integer>();
                ArrayList<Item> theArray = new ArrayList<Item>();

		for (int i = 0; i < size; i++)
		{
                    theArray.add(new Item((Integer)myArray[i]));
			binTree.insert(theArray.get(i));
		}

		Vector myVector = new Vector(size);

		binTree.InOrder(binTree.root, myVector);

                for (int i = 0; i < size; i++)
                {
                    myArray[i] = ((Item)myVector.get(i)).toInt();
                }
	}
}